<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<link rel="stylesheet" href="../../../layui-v2.2.5/layui/css/layui.css" media="all">
<script src="../../../layui-v2.2.5/layui/layui.js" charset="utf-8"></script>

<div class="breadcrumbs" id="breadcrumbs">
    <script type="text/javascript">
        try {
            ace.settings.check('breadcrumbs', 'fixed')
        } catch (e) {
        }
    </script>

    <ul class="breadcrumb">
        <li>
            <i class="icon-home home-icon"></i>
            <a href="../../../index.jsp">首页</a>
        </li>

        <li>
            添加文件
        </li>

    </ul><!-- .breadcrumb -->
</div>

<div class="page-content">
    <div class="page-header">
        <h1>
            添加文件
        </h1>
    </div><!-- /.page-header -->

    <div class="row">
        <div class="col-xs-12">
            <!-- PAGE CONTENT BEGINS -->

            <form class="form-horizontal" action="insertFile" method="post"  >
                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right"> 合同名称： </label>

                    <div class="col-sm-9">
                        <input type="text" name="file_name" style="height: 38px; "  class="col-xs-10 col-sm-5"/>
                    </div>
                </div>

                <div class="space-4"></div>

                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right"> 合作企业： </label>

                    <div class="col-sm-9">
                        <input type="text" style="height: 38px; " name="file_enterprise"  class="col-xs-10 col-sm-5"/>
                    </div>
                </div>

                <div class="space-4"></div>

                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right"> 签约时间：</label>
                    <div class="col-sm-9">

                            <div class="layui-input-inline">
                                <input type="text" name="date" id="date" lay-verify="date" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">

                        </div>
                    </div>
                </div>

                <div class="space-4"></div>

                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right"> 多图片上传： </label>


                        <div class="layui-upload" >
                            <button style="margin-left: 12px" type="button" class="layui-btn" id="test2">多图片上传</button>
                            <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
                                预览图：
                                <div class="layui-upload-list" id="demo2"></div>
                            </blockquote>
                        </div>
                    </div>


                <div class="space-4"></div>
                <div class="space-4"></div>

                <div>
                    <div class="col-md-offset-3 col-md-9">
                        <button class="btn btn-info" type="submit" >
                            <i class="icon-ok bigger-110"></i>
                            保存
                        </button>

                        &nbsp; &nbsp; &nbsp;
                        <button class="btn btn-info" type="reset">
                            <i class="icon-undo bigger-110"></i>
                            重写
                        </button>
                    </div>
                </div>

            </form>

            <div class="hr hr-18 dotted hr-double"></div>


        </div><!-- /.col -->
    </div><!-- /.row -->
</div>

<script>
    layui.use(['form', 'layedit', 'laydate'], function(){
        var form = layui.form
            ,layer = layui.layer
            ,layedit = layui.layedit
            ,laydate = layui.laydate;

        //日期
        laydate.render({
            elem: '#date'
        });
        laydate.render({
            elem: '#date1'
        });


        //监听提交
        form.on('submit(demo1)', function(data){
            layer.alert(JSON.stringify(data.field), {
                title: '最终的提交信息'
            })
            return false;
        });


    });
</script>

<script>
    layui.use('upload', function(){
        var $ = layui.jquery
            ,upload = layui.upload;

        //多图片上传
        upload.render({
            elem: '#test2'        //指向容器选择器【id="test2"】
            ,url: '/addFile/'  //服务端上传接口路径
            ,multiple: true       //是否允许多文件上传。设置 true即可开启。不支持ie8/9
            ,before: function(obj){
                //预读本地文件示例，不支持ie8
                obj.preview(function(index, file, result){
                    $('#demo2').append('<img src="'+ result +'" alt="'+ file.name +'" style="width: 290px;height: 250px;"   class="layui-upload-img">')
                });
            }
            ,done: function(res){
                //上传完毕
            }
        });
    });
</script>